package com.example.springboot.mapper;

import com.example.springboot.entity.Inventory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
//操作数据库的接口
public interface InventoryMapper {

    @Select("select * from `inventory` ")
    List<Inventory> selectAll();

    @Select("select * from inventory where id = #{id}")
    List<Inventory> selectById(@Param("id") Long id);

    @Select("select * from inventory where product_name = #{name}")
    List<Inventory> selectByProductName(String name);

    @Select("select * from inventory where category = #{category}")
    List<Inventory> selectByCategory(@Param("category") String category);

    @Select("select * from inventory where brand = #{brand}")
    List<Inventory> selectByBrand(@Param("brand") String brand);

    @Select("select * from inventory where supplier = #{supplier}")
    List<Inventory> selectBySupplier(@Param("supplier") String supplier);
}
